package main

import (
	"flag"
	"fmt"

	{{.importPackages}}
)

var (
	configFile = flag.String("f", "etc/shapeServer-api.yaml", "the config file")
	gfcfgFile  = flag.String("gffile", "config.yaml", "the gf config file")
	gfcfgPath  = flag.String("gfpath", "./etc", "the gf config file")
)


func main() {
	flag.Parse()

	var c config.Config
	conf.MustLoad(*configFile, &c)

	g.Cfg().SetPath(*gfcfgPath)
	g.Cfg().SetFileName(*gfcfgFile)
	
	ctx := svc.NewServiceContext(c)
	server := rest.MustNewServer(c.RestConf)
	defer server.Stop()

	handler.RegisterHandlers(server, ctx)

	fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
	server.Start()
}
